/**
 * Copyright (C), 2002-2017, 上海巧房信息技术有限公司
 * FileName: CollectRuleFacadeImpl.java
 * Author:   yi.li
 * Date:     2018年6月29日 下午2:43:07
 * Description:  采集规则
 * History: //修改记录
 * <author>      <time>      <version>    <desc>
 * 修改人姓名             修改时间            版本号                  描述
 */
package com.qiaofang.collectmanage.facade.impl;


import com.qiaofang.collectmanage.service.CollectRuleService;
import com.qiaofang.collectmanage.stub.constants.InputRuleResponseCode;
import com.qiaofang.collectmanage.stub.facade.InputRuleFacade;
import com.qiaofang.collectmanage.stub.request.*;
import com.qiaofang.collectmanage.stub.response.*;
import com.qiaofang.common.response.CommonResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
public class InputRuleFacadeImpl implements InputRuleFacade {

	@Autowired
	private CollectRuleService collectRuleService;

	@Override
	public CommonResponse inputCollectRuleDataToDbByUuid(@RequestBody @Valid InputCollectRuleDataToDbByUuidRequest request) {
		CommonResponse commonResponse = new CommonResponse();
		if(!"INPUTOK".equals(request.getCode())){
			return new InputCityDataToDbByUuidResponse(InputRuleResponseCode.RC_INPUT_AUTH_NO.getResponseCode(),InputRuleResponseCode.RC_INPUT_AUTH_NO.getResponseMessage());
		}
		collectRuleService.inputCityDataToDbByUuid(request.getUuids());
		return commonResponse;
	}
}
